/**
 * 
 */
package com.gmail.sabuj.career.qna.core.expression;

/**
 * @author Sabuj Das | sabuj.das@gmail.com
 * 
 */
public class Pattern {

	private final String expression;

	private static Pattern instance;

	private Pattern(String pattern) {
		this.expression = pattern;
	}

	public static Pattern init(String expression) {
		if (null == instance) {
			synchronized (Pattern.class) {
				if (null == instance) {
					instance = new Pattern(expression);
				}
			}
		}
		return instance;
	}

	public String getExpression() {
		return expression;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Pattern [expression= ");
		builder.append(expression);
		builder.append(" ]");
		return builder.toString();
	}

}
